<!-- The file upload form used as target for the file upload widget -->
<form id="gallery_upload" action="<?php echo site_url();?>admin_gallery/do_upload_image" method="POST" enctype="multipart/form-data">
    <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
    <div class="row fileupload-buttonbar">
        <div class="col-lg-7">
            <!-- The fileinput-button span is used to style the file input field as button -->
            <span class="btn btn-success fileinput-button">
                <i class="glyphicon glyphicon-plus"></i>
                <span>Add files...</span>
                <input type="file" name="userfile" multiple>
            </span>
            <button type="submit" class="btn btn-primary start">
                <i class="glyphicon glyphicon-upload"></i>
                <span>Start upload</span>
            </button>
            <button type="reset" class="btn btn-warning cancel" id="cancel-upload-img">
                <i class="glyphicon glyphicon-ban-circle"></i>
                <span>Cancel upload</span>
            </button>
            <!-- The global file processing state -->
            <span class="fileupload-process"></span>
        </div>
        <!-- The global progress state -->
        <div class="col-lg-5 fileupload-progress fade">
            <!-- The global progress bar -->
            <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
                <div class="progress-bar progress-bar-success" style="width:0%;"></div>
            </div>
            <!-- The extended global progress state -->
            <div class="progress-extended">&nbsp;</div>
        </div>
    </div>
    
    <!-- The table listing the files available for upload/download -->
    <table class="table" role="presentation" style="border-bottom: 1px solid #ddd;">
        <tbody class="files"></tbody>
    </table>
</form>

<!-- The blueimp Gallery widget -->
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even">
    <div class="slides"></div>
    <h3 class="title"></h3>
    <a class="prev">‹</a>
    <a class="next">›</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
</div>

<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
    {% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade">
        <td class="title">
            <div class="form-group" style="margin-bottom: 0;">
                <input type="text" name="title" class="form-control" placeholder="Title" />
            </div>
        </td>
        <td class="title">
            <div class="form-group" style="margin-bottom: 0;">
                <div style="padding-left: 0px;" class="input-group date image_date" data-date="<?php echo date('Y-m-d H:i:s'); ?>" data-date-format="yyyy-mm-dd HH:ii:ss" data-link-field="dtp_input1">
                    <input id="tanggal_image"  class="form-control" size="16" type="text" value="" readonly="readonly" />
                    <span class="input-group-addon">
                        <span class="glyphicon glyphicon-remove"></span>
                    </span>
                    <span class="input-group-addon">
                        <span class="glyphicon glyphicon-th"></span>
                    </span>
                </div>
                <input type="hidden" name="date" class="form-control" placeholder="Date" id="dtp_input1" value="" />
            </div>
        </td>
        <td style="vertical-align: middle;">
            <span class="name">{%=file.name%}</span>
            <strong class="error text-danger"></strong>
        </td>
        <td class="text-center" style="vertical-align: middle; width: 200px;">
            <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
        </td>
        <td class="text-right" style="vertical-align: middle; width: 100px;">
            <span class="size">Processing...</span>
        </td>
        <td class="text-right" style="width: 200px; vertical-align: middle;">
            {% if (!i && !o.options.autoUpload) { %}
                <button class="btn btn-primary start" disabled>
                    <i class="glyphicon glyphicon-upload"></i>
                    <span>Start</span>
                </button>
            {% } %}
            {% if (!i) { %}
                <button class="btn btn-warning cancel">
                    <i class="glyphicon glyphicon-ban-circle"></i>
                    <span>Cancel</span>
                </button>
            {% } %}
        </td>
    </tr>
    {% } %}
</script>

<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
    {% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-download fade">
        <td style="vertical-align: middle;">
            <span class="name">
                {% if (file.url) { %}
                    <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
                {% } else { %}
                    <span>{%=file.name%}</span>
                {% } %}
            </span>
            {% if (file.error) { %}
                <span class="label label-danger" style="margin-left: 10px;">Error</span> {%=file.error%}
            {% } %}
        </td>
        <td style="vertical-align: middle;">
            <span>{%=file.date%}</span>
        </td>
        <td class="text-right" style="vertical-align: middle;" colspan="3">
            <span class="size">{%=o.formatFileSize(file.size)%}</span>
        </td>
        <td class="text-right" style="width: 100px; vertical-align: middle;">
            {% if (file.deleteUrl) { %}
                <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
                    <i class="glyphicon glyphicon-trash"></i>
                    <span>Delete</span>
                </button>
            {% } else { %}
                <button class="btn btn-warning cancel">
                    <i class="glyphicon glyphicon-ban-circle"></i>
                    <span>Cancel</span>
                </button>
            {% } %}
        </td>
    </tr>
    {% } %}
</script>